package com.woniuxy.house.config;

import com.woniuxy.house.entity.Message;
import com.woniuxy.house.service.MessageService;
import com.woniuxy.house.service.UserService;
import com.woniuxy.house.service.serviceimpl.MessageServiceImpl;
import com.woniuxy.house.web.WebChat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.websocket.server.ServerEndpointConfig;

/**
 * @author baobo
 * @date 2022-09-05-20:10
 */
@Configuration
public class WebSocketConfig {
	@Bean
	public ServerEndpointExporter serverEndpointExporter() {
		System.out.println(">>>>>>>>>>>>>>>>>启用 WebSocket");
		return new ServerEndpointExporter();
	}
	@Autowired
	public void setMessageService(MessageService messageService){
		WebChat.messageService = messageService;
	}
	@Autowired
	public void setUserService(UserService userService){
		WebChat.userService = userService;
	}
}

